From 953aa48f733046f065f6198c911110123c75ead8 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 3 Aug 2006 11:21:34 -0600 Subject: [PATCH] [IA64] Convert some stats to perfc. Signed-off-by: Tristan Gingold --- xen/arch/ia64/asm-offsets.c | 5 ++++ xen/arch/ia64/xen/domain.c | 2 +- xen/arch/ia64/xen/faults.c | 2 +- xen/arch/ia64/xen/hypercall.c | 4 +-- xen/arch/ia64/xen/hyperprivop.S | 8 +++--- xen/arch/ia64/xen/privop_stat.c | 46 ------------------------------ xen/arch/ia64/xen/vcpu.c | 10 +++---- xen/include/asm-ia64/perfc_defn.h | 25 +++++++++++++++- xen/include/asm-ia64/privop_stat.h | 18 ------------ 9 files changed, 42 insertions(+), 78 deletions(-) diff --git a/xen/arch/ia64/asm-offsets.c b/xen/arch/ia64/asm-offsets.c index 5cb8fab9ee..5f271184ca 100644 --- a/xen/arch/ia64/asm-offsets.c +++ b/xen/arch/ia64/asm-offsets.c @@ -211,4 +211,9 @@ void foo(void) DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE])); DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK])); +#ifdef PERF_COUNTERS + BLANK(); + DEFINE(RECOVER_TO_PAGE_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_page_fault)); + DEFINE(RECOVER_TO_BREAK_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_break_fault)); +#endif } diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index a421764c2a..95d91c6751 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -136,7 +136,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) uint64_t pta; local_irq_save(spsr); - context_switch_count++; + perfc_incrc(context_switch); __ia64_save_fpu(prev->arch._thread.fph); __ia64_load_fpu(next->arch._thread.fph); diff --git a/xen/arch/ia64/xen/faults.c b/xen/arch/ia64/xen/faults.c index e370f92fef..7cb8865a79 100644 --- a/xen/arch/ia64/xen/faults.c +++ b/xen/arch/ia64/xen/faults.c @@ -170,7 +170,7 @@ handle_lazy_cover(struct vcpu *v, struct pt_regs *regs) PSCB(v,ifs) = regs->cr_ifs; PSCB(v,incomplete_regframe) = 1; regs->cr_ifs = 0; - lazy_cover_count++; + perfc_incrc(lazy_cover); return(1); // retry same instruction with cr.ifs off } return(0); diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index e7d5e32f3e..f7bc76a27a 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -210,7 +210,7 @@ fw_hypercall (struct pt_regs *regs) if (regs->r28 == PAL_HALT_LIGHT) { if (vcpu_deliverable_interrupts(v) || event_pending(v)) { - idle_when_pending++; + perfc_incrc(idle_when_pending); vcpu_pend_unspecified_interrupt(v); //printf("idle w/int#%d pending!\n",pi); //this shouldn't happen, but it apparently does quite a bit! so don't @@ -219,7 +219,7 @@ fw_hypercall (struct pt_regs *regs) //as deliver_pending_interrupt is called on the way out and will deliver it } else { - pal_halt_light_count++; + perfc_incrc(pal_halt_light); do_sched_op_compat(SCHEDOP_yield, 0); } regs->r8 = 0; diff --git a/xen/arch/ia64/xen/hyperprivop.S b/xen/arch/ia64/xen/hyperprivop.S index 5a2e288994..7c977c52b8 100644 --- a/xen/arch/ia64/xen/hyperprivop.S +++ b/xen/arch/ia64/xen/hyperprivop.S @@ -977,8 +977,8 @@ END(fast_tlb_miss_reflect) // we get here if fast_insert fails (e.g. due to metaphysical lookup) ENTRY(recover_and_page_fault) -#ifdef FAST_REFLECT_CNT - movl r21=recover_to_page_fault_count;; +#ifdef PERF_COUNTERS + movl r21=perfcounters + RECOVER_TO_PAGE_FAULT_PERFC_OFS;; ld8 r22=[r21];; adds r22=1,r22;; st8 [r21]=r22;; @@ -2009,8 +2009,8 @@ END(hyper_ptc_ga) // recovery block for hyper_itc metaphysical memory lookup ENTRY(recover_and_dispatch_break_fault) -#ifdef FAST_REFLECT_CNT - movl r21=recover_to_break_fault_count;; +#ifdef PERF_COUNTERS + movl r21=perfcounters + RECOVER_TO_BREAK_FAULT_PERFC_OFS;; ld8 r22=[r21];; adds r22=1,r22;; st8 [r21]=r22;; diff --git a/xen/arch/ia64/xen/privop_stat.c b/xen/arch/ia64/xen/privop_stat.c index b6fe406fad..eff99f72d7 100644 --- a/xen/arch/ia64/xen/privop_stat.c +++ b/xen/arch/ia64/xen/privop_stat.c @@ -3,18 +3,6 @@ #include #include -unsigned long dtlb_translate_count = 0; -unsigned long tr_translate_count = 0; -unsigned long phys_translate_count = 0; -unsigned long vhpt_translate_count = 0; -unsigned long fast_vhpt_translate_count = 0; -unsigned long recover_to_page_fault_count = 0; -unsigned long recover_to_break_fault_count = 0; -unsigned long idle_when_pending = 0; -unsigned long pal_halt_light_count = 0; -unsigned long context_switch_count = 0; -unsigned long lazy_cover_count = 0; - unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 }; unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 }; @@ -235,38 +223,6 @@ static int zero_privop_counts(char *buf) return s - buf; } -static int dump_misc_stats(char *buf) -{ - char *s = buf; - s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count); - s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count); - s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count); - s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count); - s += sprintf(s,"Physical translations: %ld\n",phys_translate_count); - s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count); - s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count); - s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending); - s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count); - s += sprintf(s,"context switches: %ld\n",context_switch_count); - s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count); - return s - buf; -} - -static void zero_misc_stats(void) -{ - dtlb_translate_count = 0; - tr_translate_count = 0; - phys_translate_count = 0; - vhpt_translate_count = 0; - fast_vhpt_translate_count = 0; - recover_to_page_fault_count = 0; - recover_to_break_fault_count = 0; - lazy_cover_count = 0; - pal_halt_light_count = 0; - idle_when_pending = 0; - context_switch_count = 0; -} - static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = { 0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i", "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d", @@ -360,7 +316,6 @@ int dump_privop_counts_to_user(char __user *ubuf, int len) n += dump_privop_addrs(buf + n); #endif n += dump_vhpt_stats(buf + n); - n += dump_misc_stats(buf + n); if (__copy_to_user(ubuf,buf,n)) return -1; return n; @@ -381,7 +336,6 @@ int zero_privop_counts_to_user(char __user *ubuf, int len) zero_privop_addrs(); #endif zero_vhpt_stats(); - zero_misc_stats(); zero_reflect_counts(); if (__copy_to_user(ubuf,buf,n)) return -1; diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index fbbfc5e474..7b13d68556 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -1500,7 +1500,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt *pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX; *itir = PAGE_SHIFT << 2; - phys_translate_count++; + perfc_incrc(phys_translate); return IA64_NO_FAULT; } } @@ -1521,7 +1521,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt if (trp != NULL) { *pteval = trp->pte.val; *itir = trp->itir; - tr_translate_count++; + perfc_incrc(tr_translate); return IA64_NO_FAULT; } } @@ -1531,7 +1531,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt if (trp != NULL) { *pteval = trp->pte.val; *itir = trp->itir; - tr_translate_count++; + perfc_incrc(tr_translate); return IA64_NO_FAULT; } } @@ -1544,7 +1544,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt && vcpu_match_tr_entry_no_p(trp,address,rid)) { *pteval = pte.val; *itir = trp->itir; - dtlb_translate_count++; + perfc_incrc(dtlb_translate); return IA64_USE_TLB; } @@ -1582,7 +1582,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt /* found mapping in guest VHPT! */ *itir = rr & RR_PS_MASK; *pteval = pte.val; - vhpt_translate_count++; + perfc_incrc(vhpt_translate); return IA64_NO_FAULT; } diff --git a/xen/include/asm-ia64/perfc_defn.h b/xen/include/asm-ia64/perfc_defn.h index 112214236f..32532dd143 100644 --- a/xen/include/asm-ia64/perfc_defn.h +++ b/xen/include/asm-ia64/perfc_defn.h @@ -1 +1,24 @@ -/* This file is empty. */ +#ifndef XEN_PERFC_DEFN_H +#define XEN_PERFC_DEFN_H + +PERFCOUNTER_CPU(dtlb_translate, "dtlb hit") + +PERFCOUNTER_CPU(tr_translate, "TR hit") + +PERFCOUNTER_CPU(vhpt_translate, "virtual vhpt translation") +PERFCOUNTER_CPU(fast_vhpt_translate, "virtual vhpt fast translation") + +PERFCOUNTER(recover_to_page_fault, "recoveries to page fault") +PERFCOUNTER(recover_to_break_fault, "recoveries to break fault") + +PERFCOUNTER_CPU(phys_translate, "metaphysical translation") + +PERFCOUNTER_CPU(idle_when_pending, "vcpu idle at event") + +PERFCOUNTER_CPU(pal_halt_light, "calls to pal_halt_light") + +PERFCOUNTER_CPU(context_switch, "context switch") + +PERFCOUNTER_CPU(lazy_cover, "lazy cover") + +#endif diff --git a/xen/include/asm-ia64/privop_stat.h b/xen/include/asm-ia64/privop_stat.h index 92e445da3e..bb796eee90 100644 --- a/xen/include/asm-ia64/privop_stat.h +++ b/xen/include/asm-ia64/privop_stat.h @@ -7,24 +7,6 @@ extern int zero_privop_counts_to_user(char *, int); #define PRIVOP_ADDR_COUNT -/* vcpu_translate hit with dtlb. */ -extern unsigned long dtlb_translate_count; - -/* vcpu_translate hit with tr. */ -extern unsigned long tr_translate_count; - -/* vcpu_translate in metaphysical mode. */ -extern unsigned long phys_translate_count; - -extern unsigned long vhpt_translate_count; -extern unsigned long fast_vhpt_translate_count; -extern unsigned long recover_to_page_fault_count; -extern unsigned long recover_to_break_fault_count; -extern unsigned long idle_when_pending; -extern unsigned long pal_halt_light_count; -extern unsigned long context_switch_count; -extern unsigned long lazy_cover_count; - extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1]; extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1]; -- 2.30.2